package pl.mmadej.ds4java.ds.queue;


import pl.mmadej.ds4java.ds.list.LinkedList;
import pl.mmadej.ds4java.ds.list.List;

public class LinkedListQueue<T> implements Queue<T> {

    private List<T> list = new LinkedList<T>();

    @Override
    public void enqueue(T t) {
        list.insert(t);
    }

    @Override
    public T dequeue() {
        return list.deleteFirst();
    }

    @Override
    public int size() {
        return list.size();
    }

    @Override
    public boolean empty() {
        return size() == 0;
    }

    @Override
    public <E> E[] toArray(E[] e) {
        return list.toArray(e);
    }

    @Override
    public void clear() {
        list.clear();
    }
}
